<?php 
session_start();
require_once("include/authen.php");
require_once("include/ui.php");

if ($_SESSION["permission"][$monthly_sale_report]["View"]=="0"){
	echo "<script>alert('".$no_permit."');</script>";
	echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	exit();
}
echo headerPage("Monthly Sale Report");
?>
<script>
$(function() {
	 
	$("#btnPrint").button({
				icons:{
				 primary: "ui-icon-print"
				}
	});
 
			
	$.get('a_main.php',{"cy":"y"},function(data){
	 
		var obj=eval('('+data+')');

		if (obj !=null){
			$.each(obj, function(index, text) {
				$("#yearfrom,#yearto").append(
						$('<option></option>').val(index).html(text)
				 );
			});
		}
	});
 	$.get('a_user.php',{"c":"b"},function(data){
		var obj=eval('('+data+')');
		if (obj !=null){
			$.each(obj, function(index, text) {
				$("#cboBranch").append(
						$('<option></option>').val(text).html(index)
				 );
			});
		}
		if ( $("#isHO").val()=='0' ) 
			$("#cboBranch").val($("#bid").val()).attr('disabled','disabled');
	 
	});
	if  ( $("#isHO").val()=='1' ) {
			$("#cboBranch").append($('<option></option>').val(0).html('All'));
	}
	
	$("#btnPrint").click(function(){
 
			$("#mFrom").val( $("#monthfrom").val() );
			$("#mTo").val( $("#monthto").val() );
			$("#yTo").val( $("#yearto").val() );
			$("#yFrom").val( $("#yearfrom").val() );
			$("#branch").val( $("#cboBranch").val() );
			
			//alert($("#dFrom").val());
				return false;	
	 
	});	
});
</script>

<FORM name="Act" id="Act" action="monthly_sale.php" method="post" target="_blank"> 
<INPUT type=hidden value="" id="mFrom" name="mFrom"> 
<INPUT type=hidden value="" id="mTo" name="mTo"> 
<INPUT type=hidden value="" id="yFrom" name="yFrom"> 
<INPUT type=hidden value="" id="yTo" name="yTo"> 
<INPUT type=hidden value="" id="branch" name="branch"> 
<INPUT type=hidden value="<?php echo $_SESSION['bid'];?>" id="bid" name="bid"> 
<INPUT type=hidden value="<?php echo $_SESSION['branchtype'];?>" id="isHO" name="isHO"> 
<table width="1024" height="400px" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
 
    <td width="10" style='border-left:2px solid #facb0c;'>&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr><td></td>
                         </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/doc.png);">
						Monthly Sale Report
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
				<fieldset  class="ui-widget ui-widget-content">
				<legend>Monthly Sale Report</legend>	
                    <table width="100%"  id="infotable" style="line-height:36px;padding-top:10px;">
                        <tr>
                            <td width="25%" class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name">&nbsp;&nbsp;Month-Year From : </label>
								 <select id='monthfrom' style="border:1px solid #ccc;font-size:12px;padding:2px;">
									<option value="1">มกราคม</option>
									<option value="2">กุมภาพันธ์</option>
									<option value="3">มีนาคม</option>
									<option value="4">เมษายน</option>
									<option value="5">พฤษภาคม</option>
									<option value="6">มิถุนายน</option>
									<option value="7">กรกฏาคม</option>
									<option value="8">สิงหาคม</option>
									<option value="9">กันยายน</option>
									<option value="10">ตุลาคม</option>
									<option value="11">พฤศจิกายน</option>
									<option value="12">ธันวาคม</option>
								 </select>
								<select id='yearfrom' style="border:1px solid #ccc;font-size:12px;padding:2px;">
=								 </select>
							</td>
                            <td width="25%" class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name">Month-Year To : </label>
								 <select id='monthto' style="border:1px solid #ccc;font-size:12px;padding:2px;">
									<option value="1">มกราคม</option>
									<option value="2">กุมภาพันธ์</option>
									<option value="3">มีนาคม</option>
									<option value="4">เมษายน</option>
									<option value="5">พฤษภาคม</option>
									<option value="6">มิถุนายน</option>
									<option value="7">กรกฏาคม</option>
									<option value="8">สิงหาคม</option>
									<option value="9">กันยายน</option>
									<option value="10">ตุลาคม</option>
									<option value="11">พฤศจิกายน</option>
									<option value="12">ธันวาคม</option>
								 </select>
								<select id='yearto' style="border:1px solid #ccc;font-size:12px;padding:2px;">
								 </select>
							</td>							
						</tr>
						<tr>
							<td width="100%" colspan="2" class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name" style='padding-right:55px'>&nbsp;&nbsp;Branch : </label><select id='cboBranch' style='font-size:12px;padding:2px;'></select>
							</td>
						</tr>
						<tr>
							<td width="100%" colspan="2" class="fontSearch" align="right">
								<button id="btnPrint" style="font-size:12px">Print</button>
							</td>
						</tr>
                    </table>
				</fieldset>
				<p></P>
                 <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" style='border-right:2px solid #facb0c;'>&nbsp;</td>
  </tr>
</table>
 </FORM>
<?php echo footer();?>